package willevaluate.activity;

import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;

import com.example.xuegengwang.xuegengwang.R;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

import common.BaseActivity;
/**
 * Created by Administrator on 2017/5/24.
 * 3000/5000提交完毕
 */

@ContentView(R.layout.expert_evaluate_finish)
public class ExpertEvaluateFinish extends BaseActivity implements View.OnClickListener {
    @ViewInject(R.id.common_back)
    private ImageView common_back;
    @ViewInject(R.id.common_title)
    private TextView common_title;
    @ViewInject(R.id.expert_evaluate_finish_tv)
    private TextView expert_evaluate_finish_tv;
    @ViewInject(R.id.expert_evaluate_finish_back)
    private Button expert_evaluate_finish_back;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityController.addActivity(this);
        expert_evaluate_finish_back.setOnClickListener(this);
        initView();
    }

    private void initView() {
        common_title.setText("填报志愿");
        common_back.setOnClickListener(this);
        expert_evaluate_finish_tv.setOnClickListener(this);
        SpannableString content = new SpannableString("你的信息已成功提交,工作人员会在两个工作日内跟你取得联系,或可致电今朝客户电话：020-3835512");
        ClickableSpan clickableSpan = new ClickableSpan() {
            @Override
            public void updateDrawState(TextPaint ds) {
                int color = ExpertEvaluateFinish.this.getResources().getColor(R.color.common_color);
                ds.setColor(color);
                ds.setUnderlineText(false); //去掉下划线
            }

            @Override
            public void onClick(View widget) {

            }
        };
        content.setSpan(clickableSpan, content.length()-11,content.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
        expert_evaluate_finish_tv.setText(content);
        expert_evaluate_finish_tv.setMovementMethod(LinkMovementMethod.getInstance());
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.common_back:
            case R.id.expert_evaluate_finish_back:
                finishAll();
                break;
            default:
                break;
        }
    }

    @Override
    public void onBackPressed() {
        finishAll();
    }

    private void finishAll() {
        ActivityController.finishActivity();
    }
}
